# coding:UTF-8

from ADABOOST import runAdaBoost
from KNN import runKNN
from SGD import runSGD
from DecisionTree import runDecisionTree
from GaussianNB import runGaussianNB
from SVM import runSVM

with open ('./data/result.csv' ,'w',encoding='utf-8') as result:
    with open('./data/time.csv', 'w', encoding='utf-8') as time:
        result.write(',SVM,GaussianNB,SGD,KNN,AdaBoost,DecisionTree\n')
        time.write(',SVM,GaussianNB,SGD,KNN,AdaBoost,DecisionTree\n')
        for dataname in ['banana', 'breast_cancer', 'diabetis', 'flare_solar', 'german', 'heart', 'image', 'ringnorm', 'splice', 'thyroid',
             'titanic', 'twonorm', 'waveform']:
            result.write(dataname+',')
            time.write(dataname + ',')
            runtime,runresult=runSVM(dataname)
            result.write(str(runresult)+',')
            time.write(str(runtime)+',')
            runtime, runresult = runGaussianNB(dataname)
            result.write(str(runresult)+ ',')
            time.write(str(runtime)+ ',')
            runtime, runresult = runSGD(dataname)
            result.write(str(runresult)+ ',')
            time.write(str(runtime)+ ',')
            runtime, runresult = runKNN(dataname)
            result.write(str(runresult)+ ',')
            time.write(str(runtime)+ ',')
            runtime, runresult = runAdaBoost(dataname)
            result.write(str(runresult)+ ',')
            time.write(str(runtime)+ ',')
            runtime, runresult = runDecisionTree(dataname)
            result.write(str(runresult)+ '\n')
            time.write(str(runtime)+ '\n')


